<%-- 
    Document   : venta
    Created on : 14-jun-2012, 12:37:52
    Author     : Administrador
--%>
<%@page import="com.javabeans.Facultad"%>
<%@page import="com.javabeans.Gestion"%>
<%@page import="com.javabeans.VentaMatricula"%>
<%@page import="com.util.UtilDate"%>
<%@include file="../../../../controlSession.jsp" %>
<%    
    boolean isNew = (Boolean) request.getAttribute("isNew");// para saber si es por unidad académica o es general
    Facultad  f = (Facultad) request.getAttribute("facultad");
    String nombreGestion = (String)request.getAttribute("gestionElegido"); // valor enviado IDGESTION_IDFACULTAD_NOMBREGESTION
    String gestion = (String)request.getAttribute("gestion");
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>SI-ESFM</title>
        <meta name="description" content="Derechos Reservados SI-ESFM." />
        <link rel="stylesheet" href="<%=s_path%>/css/styles.css" type="text/css" />
        <link rel="stylesheet" href="<%=s_path%>/css/menu/style.css" type="text/css" />
        <link rel="shortcut icon" href="<%=s_path%>/images/ico.png" type="image/png"/>        
        <link rel="stylesheet" href="<%=s_path%>/css/themes/start/jquery-ui-1.8.20.custom.css" type="text/css" />
        <style type="text/css">
            /* para la factura*/
            .principal{padding-top: 0.4em;width: 182pt;text-align: center;font-size: 0.8em;font-family: arial;}
            .marco{padding-top: 0.4em;border: 0.1em solid #000000;width: 182pt;text-align: center;font-size: 0.9em;font-weight: bold;font-family: arial;}
            .form_labelAlign{float:left;width:35%;text-align:right;}
            .form_labelAlignF{float:left; margin-left:0.2em;}
            .form_label_align20{float:left;width:20%;text-align:right;}
            .form_input_alignF {float:left;margin-left:0.2em;}
            .tamanioFont08em{font-size: 0.8em;}
            .tamanioFont09em{font-size: 0.9em;}
            .miScroll{height:520px;background-color:#FFFFFF;overflow:auto;}
        </style>
        <style type="text/css" media="print">
             #middle,.izq,.yDer,#header-wrap,#field{
                 display: none;}             
         </style>
        <script type="text/javascript" src="<%=s_path%>/js/comun.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/jquery.formalize.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/validate/jquery.validate.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/validate/jquery.numeric.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/jquery.form.js"></script>
        
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.core.min.js"></script>  <!--si o si cargar esto-->
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.widget.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.position.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.mouse.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.button.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.draggable.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.resizable.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.dialog.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.effects.core.min.js"></script>
        
        <script type="text/javascript" src="<%=s_path%>/js/jquery.print.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                limpiarDatos();              
                // validacion del formBusqueda
                $("#formBusqueda").validate({
                    ignoreTitle: true,
                    messages:{
                        codsis:{ required : 'Ingrese el co\u00f3digo sis.'}
                    }
                });
                // envio del formBusqueda
                $('#formBusqueda').ajaxForm({
                    beforeSend:function(obj){
                        $('#imgLoad').css({display:'block'});
                    },
                    success: function(res, statusText, xhr, form){
                       $("#divResultado").css({display:'block'});
                       $("#divResultado").html(res);
                    },
                    complete:function(){
                        $("#divGestion").css({display:'none'});
                        $("#divCodSis").css({display:'none'});
                        $('#imgLoad').css({display:'none'});
                    },
                    error:function(){
                       alert("error! al buscar el estudiante con c\u00f3digo sis.");
                    }
		});
            });
            function limpiarDatos(){
                $("#gestion").val("");// cuando haga f5 entonces se inicializa los valores en vacio
                $("#codsis").val(""); // limpiamos el input de cod-sis
            }
            function cancelar(){
                location.href="Transacciones?accion=2&idMenu=5&idSubMenu=1&isNew=<%=isNew%>"+"&gestion=<%=gestion%>"+"&gestionElegido=<%=nombreGestion%>";
            }
        </script>
    </head>
    <body onload="showTime(<%=s_param%>)">
        <div id="top-wrap">
            <!-- cabeza principal -->
            <%@include file="../../../../head.jsp" %>
            
            <!-- cuerpo -->
            <div id="bodySpace">               
                <!-- aqui va la ruta -->
                <div class="clearfix" id="middle" style="position: absolute">
                    <!-- aqui va el arbol de entrada -->
                    <div id="breadcrumb"><!-- le da la forma de la imagen -->
                        <ul>
                            <li><a>Home</a></li>
                            <li><span style="color:#666">Transacciones</span></li>
                            <li><span style="color:#666">Matriculaci&oacute;n</span></li>
                            <li class="current-page"><span class="end"><span class="middle">Venta</span></span></li>
                        </ul>                     
                    </div><!-- begin SIDEBAR FIRST -->
                </div>
                
                <div id="principal">
                    <!-- izquierda -->
                    <div class="cuerpo2y" style="border: 0px solid"><br/><br/><!-- estos break son necesarios ya q uso absolute en css  cuerpo izquierdo-->
                        <div class="izq">
                            <%//@include file="../../../bodyIzq.jsp" %>
                            <!-- inicio inicio -->
                            <div id="menuprin"><!-- como no tiene menu izquierdo entonces le ponemos algo estatico solo pa q se vea bien -->
                                <div class="menuIzqMarco">
                                    <div class="menu_css">
                                        <h3 class="title">Seleccione</h3>
                                        <div class="menu_selected menu_selectedDepen">
                                            <ul class="menuLogoNone"></ul>
                                        </div>
                                    </div>
                                </div>
                           </div><!-- fin inicio -->
                        </div>
                        <div class="medio" style="border: 0px solid">                            
                            <!--<center>-->                         
                                <fieldset id="field" style="border: 1px solid #003a96;border-radius: 8px;width: 95%;padding: 10px 10px 6px;margin-top: 10px;background-color: white;box-shadow: 0px 3px 5px #003a96, 0 0 0 2px #003a96 inset;position: relative;height: 350px">
                                    <!-- para la gestion -->
                                    <form id="formBusqueda" method='post' action='Transacciones'>
                                        <div id="divGestion">
                                            <div style="clear:both;">
                                                <h2 style="color:#004080;text-align: center; margin:3px 0px 3px 0px;">Sistema &uacute;nico de Matr&iacute;cula</h2><br/>
                                            </div>
                                            <div id="imgLoad" style="float: left;width: 100%;display: none;"><img src="<%=s_path%>/images/imgLoad/ajax-loader.gif" width="32" height="32" alt="ajax-loader.gif" style="position:absolute; top:26%; left:50%;"/></div> 
                                                <%
                                                    //if(isNew){
                                                        VentaMatricula vMatriculas = (VentaMatricula) request.getAttribute("ventaMatriculaXfacult");
                                                        String auxGestion[] = nombreGestion.split("_");// valor enviado IDGESTION_IDFACULTAD_NOMBREGESTION
                                                        out.println("<input type='hidden' name='accion' value='3'/>");
                                                        
                                                        out.println("<div style='clear: both'>");
                                                        out.println("    <label class='form_align45'>Unidad Acad&eacute;mica :</label>");
                                                        out.println("    <label style='float: left;margin-left:0.2em;font-weight: bold;'>"+f.getNombre()+"</label>");
                                                        out.println("</div>");
                                                        
                                                        out.println("<div style='clear: both'>");
                                                        out.println("    <label class='form_align45'>Gestion :</label>");
                                                        out.println("    <label style='float: left;margin-left:0.2em;font-weight: bold;'>"+auxGestion[2] +"</label>");
                                                        out.println("</div>");
                                                        if( vMatriculas.getIdVentaMatricula() != 0 ){
                                                            Gestion g = vMatriculas.getGestion();
                                                            out.println("   <input type='hidden' name='idFacultad' value='"+g.getFacultad().getIdFacultad()+"'/>");
                                                            out.println("   <input type='hidden' name='costo' value='"+vMatriculas.getCosto()+"'/>");
                                                            out.println("   <input type='hidden' name='gestion' value='"+g.getIdGestion()+"'/>");
                                                            out.println("   <input type='hidden' name='gral' value='"+isNew+"-"+gestion+"-"+nombreGestion+"'/>");
                                                            
                                                            out.println("<div style='clear: both'><br/>");
                                                            out.println("    <label class='form_align45'>Cod-Sis :</label>");
                                                            out.println("    <input type='text' name='codsis' id='codsis' value='' class='required form_input_align digits' maxlength='9' title='Ingrese el c&oacute;digo sis.' placeholder='Ingrese cod-sis...' autofocus='autofocus'/>");
                                                            out.println("    <label class='error' >*</label>");
                                                            out.println("</div>");
                                                            out.println("<div style='clear: both'>");
                                                            out.println("    <label class='form_align45'>&nbsp;</label>");
                                                            out.println("    <table border='0' style='float: left'>");
                                                            out.println("        <tr>");
                                                            out.println("            <td style='text-align:right'><input type='submit' value='Buscar' class='boton' title='Pulsa aqu&iacute; para buscar.' />&nbsp;&nbsp;</td>");
                                                            out.println("            <td><br/>&nbsp;&nbsp;</td>");
                                                            out.println("        </tr>");
                                                            out.println("    </table>");
                                                            out.println("</div>");
                                                        }else{
                                                            // cuando es vacio
                                                            out.println("<div style='clear: both;'>");
                                                            out.println("   <center>");
                                                            out.println("       <h3 style='border: 1px solid #003a96;border-radius: 8px;width: 60%;padding: 10px 10px 10px;margin-top: 10px;background-color: white;color:red;font-weight: bold;font-size:14px;text-align: center; margin:3px 0px 3px 0px;font-style:italic;'><br/>No existe venta de matr&iacute;cula para la gesti&oacute;n.");
                                                            out.println("       </h3><br/>");
                                                            out.println("   </center>");
                                                            out.println("   <br/><br/>");
                                                            out.println("</div>");
                                                            
                                                            out.println("<div style='clear: both'>");
                                                            out.println("    <label class='form_align45'>&nbsp;</label>");
                                                            out.println("    <table border='0' style='float: left'>");
                                                            out.println("        <tr>");
                                                            out.println("            <td style='text-align:right'><input type='button' value='Ir a Inicio' class='boton' title='Pulsa aqu&iacute; para ir a inicio' onclick='javascript:location.href=\"Transacciones?accion=1&idMenu=5&idSubMenu=1\"' />&nbsp;&nbsp;</td>");
                                                            out.println("            <td><br/>&nbsp;&nbsp;</td>");
                                                            out.println("        </tr>");
                                                            out.println("    </table>");
                                                            out.println("</div>");
                                                        }
                                                %>
                                        </div>
                                    </form>
                                    <!-- para mostrar los resultados de la busqueda -->
                                    <div id="divResultado" style="display: none"></div>
                                    
                                </fieldset>
                                <div id="divInsertar" style="display: none" class='printable'></div>
                            <!--</center>-->
                        </div>
                        
                    </div><!--end of leftPan-->
                    
                    <div class="yDer" style="border: 1px solid #ccc;">
                        <%@include file="../../../../publicidad.jsp" %>                       
                    </div><!--end of rightPan-->
                </div><!--end of content-wrapper-->
            </div><!--end of body-wrap-->
            
            <!-- footer -->
        </div>
    </body>
</html>
